from flask_restful import Api
from common.toutiaoapi.output import output_json

# 重写init方法
class BaseApi(Api):

    def __init__(self, app=None, prefix='',
                 default_mediatype='application/json', decorators=None,
                 catch_all_404s=False, serve_challenge_on_401=False,
                 url_part_order='bae', errors=None):

        # 父类做的事情还是需要父类来做
        super().__init__(app=app,
                         prefix=prefix,
                         default_mediatype=default_mediatype,
                         decorators=decorators,
                         catch_all_404s=catch_all_404s,
                         serve_challenge_on_401=serve_challenge_on_401,
                         url_part_order=url_part_order,
                         errors=errors
                         )

        #
        self.representations = {'application/json': output_json}